Skip to content

fix(contact-form): make captcha validate cross-origin and fix thank-you redirect#449

Merged
vitormattos merged 2 commits into
mainfrom
fix/contact-form-captcha
Jul 15, 2026
Merged

fix(contact-form): make captcha validate cross-origin and fix thank-you redirect#449
vitormattos merged 2 commits into
mainfrom
fix/contact-form-captcha

Conversation

@YvesCesar

@YvesCesar YvesCesar commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the contact form, which was unusable in production: the captcha never validated and, after a successful submit, the thank-you redirect returned 404.

Related issue: LibreCodeCoop/management#482.

Changes

  • Captcha session cookie (cross-origin): send the session cookie as SameSite=None; Secure under HTTPS so it survives the cross-origin flow between the site and contactform.libresign.coop; falls back to Lax on plain HTTP for same-origin local dev. Configuration lives in the autoloaded helper App\Support\Http\SessionCookie::configureCrossSite(), called before every session_start() in captcha.php, validate.php and audio_captcha.php.
  • Session lock / 504: call session_write_close() before the SuiteCRM request and add CURLOPT_CONNECTTIMEOUT/CURLOPT_TIMEOUT in validate.php, so a slow or unreachable CRM no longer holds the session lock and makes captcha.php time out (which caused the captcha image to disappear).
  • Thank-you redirect: redirect using an absolute, locale-aware URL (locale_url) instead of a relative path that resolved under /contact-us/ on pretty-URL hosting.

…ou redirect

Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
@YvesCesar
YvesCesar marked this pull request as draft July 14, 2026 20:45
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://libresign.github.io/site-preview/pr-preview/pr-449/

Built to branch main at 2026-07-14 21:15 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

…t\Http\SessionCookie

Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
@YvesCesar YvesCesar changed the title fix(contact-form): make captcha validate cross-origin and fix thank-y… fix(contact-form): make captcha validate cross-origin and fix thank-you redirect Jul 14, 2026
@YvesCesar
YvesCesar marked this pull request as ready for review July 14, 2026 21:21
@YvesCesar
YvesCesar requested a review from vitormattos July 14, 2026 21:22
@vitormattos
vitormattos merged commit 99a4816 into main Jul 15, 2026
5 checks passed
@vitormattos
vitormattos deleted the fix/contact-form-captcha branch July 15, 2026 01:43
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Starting production deploy of site header and footer fragments...

@vitormattos

vitormattos commented Jul 15, 2026

Copy link
Copy Markdown
Member

Deploy made at production with newest server side code. Pending to validate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants